package com.soul.controller;

import com.soul.soulcommon.result.R;
import com.soul.soulcommon.result.Result;
import com.soul.souldao.domain.Guardian;

import com.soul.soulservice.service.imp.DoctorServiceImp;
import com.soul.soulservice.service.imp.GuardianServiceImp;

import com.soul.soulservice.test.TestService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@Tag(name = "测试swagger")
@RestController
public class TestController {
    @Autowired
    private TestService testService;
    @Autowired
    private GuardianServiceImp serviceImp;
    @Autowired
    private DoctorServiceImp doctorServiceImp;
    @Operation(summary = "测试接口")
    @PreAuthorize("hasAnyAuthority('older')")
    @GetMapping("/test")
    public String test(){
        return testService.test();
    }
    @Operation(summary = "测试查找guardian表数据")
    @GetMapping("/getguardian")
    @PreAuthorize("hasAnyAuthority('guardian')")
    public Result getGuardian(){
        Guardian byId = serviceImp.getById(1);
        return Result.success(byId);
    }
}
